/* eslint-disable no-unused-vars */
import axios from './axios'
import qs from 'qs'

// 查询主单列表
export function getHostList() {
    return axios.get('/spare_parts_host/manage/get_spare_parts_host_list').then(res => {
        return Promise.resolve(res.data)
    }, (err) => {
        return Promise.reject(err)
    })
}

// 获取目录列表
export function getPartMenu(hostId) {
    return axios.post('/spare_parts_menu/manage/get_spare_parts_menu', qs.stringify({hostId})).then(res => Promise.resolve(res.data), err => Promise.reject(err))
}

// 获取该页配件列表
export function getPartMenuListMenu(menuId) {
 return axios.post('/spare_parts_menu/manage/get_spare_parts_list_on_menu',qs.stringify({menuId})).then(res => Promise.resolve(res.data), err => Promise.reject(err))
}

// 修改接口
 //主单host修改接口
export function getUpdatePartsHost(id,description,imageUrl,pdfUrl) {
    return axios.post('/spare_parts_host/manage/update_spare_parts_host',qs.stringify({id,description,imageUrl,pdfUrl})).then(res => {
        return Promise.resolve(res.data);
    },(err) => {
        return Promise.reject(err);
    })
}
// 修改下属页码信息
export function getUpadtePartsMenu(id,description,imageUrl) {
    return axios.post('/spare_parts_menu/manage/update_spare_parts_menu',qs.stringify({id,description,imageUrl})).then(res => {
        return Promise.resolve(res.data);
    },(err) => {
        return Promise.reject(err);
    })
}

// 查询配件详情接口
export function getPartsMenu(partNumber) {
    return axios.post('/spare_parts_menu/manage/get_spare_parts_detail',qs.stringify({partNumber})).then(res => {
        return Promise.resolve(res.data);
    },(err) => {
        return Promise.reject(err);
    })
}
